NeilBrown [Wed, 16 Oct 2013 01:58:51 +0000 (12:58 +1100)]
Makefile: make it easy to suppress the "-D" flag to "install".
Some versions of "install" do not support '-D', and it isn't needed
when installing to default location.
So all
make INSTALL=install
to suppress the -D
Reported-by: Christian Sonne Signed-off-by: NeilBrown <neilb@suse.de>
NeilBrown [Tue, 27 Aug 2013 23:35:14 +0000 (09:35 +1000)]
Makefile: suppress error messages from 'git'.
If you have a clone of the 'wiggle' git tree but with no
tags, then "git describe HEAD" will complain
fatal: No names found, cannot describe anything.
As it produces no output, the compiled in default will be used
so this is just an unnecessary message. So send it to /dev/null.
Reported-by: Stephen Cameron @ G+ Signed-off-by: NeilBrown <neilb@suse.de>
NeilBrown [Fri, 23 Aug 2013 04:24:14 +0000 (14:24 +1000)]
Hack to improve view of ignore-blank conflicts.
cd tests/contrib/abstract
../../../wiggle -Bb orig new new2
select the "central" and type 'x' so it disappears and note
that the only remaining difference is that "computational"
has been deleted.
Without this patch you only see one '-' line and no '+' line.
However the result isn't perfect as
./wiggle -Bp demo.patch
visit the README file
page down to waht "You can use 'o' ..." as added.
And note that there is a '-' blank line and a '+' blank line.
These are unwanted and added by this patch.
NeilBrown [Wed, 21 Aug 2013 01:40:59 +0000 (11:40 +1000)]
Preserve per-hunk "comment" field.
Each diff/patch hunk can have a comment, often a function
name extract with "diff -p".
Preserver that comment and display it when we print hunk headers,
particularly in the browser.
NeilBrown [Mon, 19 Aug 2013 05:03:37 +0000 (15:03 +1000)]
merge: fix reporting of empty "conflicts".
The important part of this patch is the end in print_merge().
If one conflict follows another with nothing in between,
then we really should try to mark up that 'nothingness' as
a resolved conflict.
The other parts as just cleaning up isolate_conflicts a bit more
as I tried to figure out what was happening.
NeilBrown [Mon, 19 Aug 2013 01:15:53 +0000 (11:15 +1000)]
Browser: Don't highlight spaces so much.
Highlighting spaces is very noisy and doesn't help very much.
We only really need to differentiate spaces from tabs and highlighting
tabs is enough for that.
We continue to highlight spaces that are adjacent to tabs, but not
other spaces.
NeilBrown [Thu, 28 Mar 2013 01:53:57 +0000 (12:53 +1100)]
Extract version information from 'git' if possible.
The version number (and date) reported by "wiggle -V" now
includes information from 'git' if the code was build from a
git repo rather than from a tar-ball.
Suggested-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: NeilBrown <neilb@suse.de>
NeilBrown [Fri, 22 Mar 2013 04:12:49 +0000 (15:12 +1100)]
merge: be more careful about aligning hunk-headers with newlines.
When matching a diff to a file, it would be very confusing.
if the last match from one hunk were on the same line of the
original as the first match of the next hunk.
So we try to align hunk-headers with newlines.
In particular, we often find Unmatched and Extraneous
sections together. There can be encoded in any order.
If the Extraneous section contains a hunk-header,
we want to make sure that if there is a newline anywhere
in the unmatched section, then the Unmatched that is placed
before the hunk-headers Extraneous ends on a newline.
There was code the attempted this, but it was too simplistic
and would sometimes move outside the regions that it should
have been examine, which would lead to various bugs.
The tests case which demonstrated this is added to the
test suite.
Reported-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: NeilBrown <neilb@suse.de>
NeilBrown [Fri, 22 Mar 2013 04:04:48 +0000 (15:04 +1100)]
csl_join should merge adjacent matches.
When diffing against a patch we treat each hunk separately
and join the result.
This joining doesn't merge adjacent matches so it doesn't really
tell the full story of where the matches are and how big
they are. This can confuse other code, particularly when
examining hunk headers to create the merger.
NeilBrown [Fri, 1 Mar 2013 08:09:35 +0000 (19:09 +1100)]
vpatch: allow a word to have text before the newline.
Previously we don't print out ends_line() words at all.
But soon a word might have some content plus a newline at
the end.
So restructure the display to print non-newline characters
from any word.
Note that we cannot have characters *after* a newline.
Doing that would break too much of wiggle's formating
assumptions.
NeilBrown [Fri, 1 Mar 2013 08:05:27 +0000 (19:05 +1100)]
Allow a word to have an unmatched prefix and suffix.
i.e. The part of a word that is tested for matching is
shorted than the whole word that is printed. There can
be a prefix and a suffix. In a future patch, an option
will be availble to include most spaces as prefix or suffix
of nearby non-space.
NeilBrown [Fri, 1 Mar 2013 07:46:00 +0000 (18:46 +1100)]
vpatch: restructure draw_mside.
We have the end-of-line handing code in the middle of
a 'while', and the only return from the function is at
the end of the eol handling. And there is nothing after the "while".
So move the eol handling code out of the while, and just put
a "break" in place of it.
NeilBrown [Fri, 1 Mar 2013 05:02:15 +0000 (16:02 +1100)]
merge: Remove noise from --show-wiggles output.
When --show-wiggles is used with whole files (current, orig, new) and
extraneous text in orig/new (Which isn't a change, so should be
ignored) is treated as a wiggle and causes a conflict to be shown.
Obviously not good.
So insist that any show-wiggle conflict contains at leas a Changed or
a Conflict. Also allow Changed and Unmatched to be 'near' each other,
not only on the same line, to signal a wiggle. Current 'near' measure
is 3 lines.
NeilBrown [Thu, 14 Feb 2013 06:31:18 +0000 (17:31 +1100)]
Add valgrind testing of parts of vpatch.
With --self-test, browsing a simple merge will simply
display at every line.
"make vtest" will run this for every merge in the test suite
and use valgrind to look for problems.
NeilBrown [Thu, 14 Feb 2013 05:30:29 +0000 (16:30 +1100)]
bestmatch: improve poor matches.
If the bestmatch doens't include all of the lines in a hunk, try to
find matches between the unmatch parts of the hunk, and surrounding
text in the original.
This is particularly useful when some of the context is just blank
lines. The best-match algorithm might ignore blank lines because they
aren't big enough to justify much distance from the rest of the match.
NeilBrown [Wed, 13 Feb 2013 23:45:57 +0000 (10:45 +1100)]
merge: remove useless context from the end of a conflict.
If we are close to the end-of-file, then don't expect
too many unchanged lines.
And allow zero lines of context in the merge if it is unchanged out
side the merge.
Update various tests to match - all clear improvements.
NeilBrown [Wed, 13 Feb 2013 23:22:18 +0000 (10:22 +1100)]
merge: remove useless context at the start of a conflict.
There are two fixes here.
The first allows the newline at the end of an unchanged region to be
the 'first' newline found so that if there are several others to
provide backup, it will be used.
The second allows the start-of-file to be strong enough context to
not require three full lines of explicit context.
Then we change a lot of the self-tests to match. In each case the
result is a clear improvement.
NeilBrown [Wed, 6 Feb 2013 23:38:15 +0000 (10:38 +1100)]
diff: make rediffing of patches more precise.
When wiggle is given a patch, it splits it into a 'before' and an
'after' section and creates a diff between those.
The hunks in the patch are separated by headers and it is assumed that
these headers will line up in the result.
However: if one hunk removes a chunk of test and another hunk adds
that chunk of text, the chunk may appear more significant than the
hunk headers, so it will line up, and the hunk headers won't
This creates a mess as one of the current tests shows, and as a
newly added test demonstrates quite neatly.
So if we are re-diffing a patch, find the hunk headers and only
diff the bits between them.
This allows the new test to work, and improves the result of the old
test.
NeilBrown [Wed, 14 Nov 2012 23:59:04 +0000 (10:59 +1100)]
vpatch: allow mode setting keys to toggle back to 'merge'.
When I set the mode to anything other than 'merge', I usually want to
then go straight back to 'merge'. And if someone does it by mistake,
a toggle function is easier to guess.
So make all mode setting commands toggle between their mode, and
'merge'.